Previous Book Contents Book Index Next

Inside Macintosh: Programming With MRJToolkit /
Chapter 2 - MRJToolkit Reference / The MRJMenuUtils Class
Methods /


setMenuItemCmdKey

Sets a key as a keyboard equivalent for a menu item.

public static final void setMenuItemCmdKey (Menu menu,
                     int itemIndex, char ch);
public static final void setMenuItemCmdKey (MenuItem item, char ch);
menu
The name of the menu that contains the desired menu item.
itemindex
The index number of the menu item. This index is zero-based.
ch
The character to set as the keyboard equivalent. The menu item is activated by selecting Command + ch.
item
The name of the desired menu item.
DISCUSSION
You can specify the menu item by its name or by indicating the menu that contains it and its index number (the first item in the menu has index 0, the second has index 1, and so on). You can assign only one character to act as the keyboard equivalent (for example, "A" but not "option- A"). For example, if you assign G as the character, Command-G selects the menu item.

SEE ALSO
The "Menu Manager" chapter in Inside Macintosh: Macintosh Toolbox Essentials.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
12 NOV 1997